﻿using UnityEngine;
using Cysharp.Threading.Tasks;
using DG.Tweening;
using System;

public static partial class Extensions
{
    /// <summary>
    /// 拉伸窗口
    /// </summary>
    public static RectTransform Stretch(this RectTransform rect)
    {
        rect.localPosition = Vector3.zero;
        var parent = rect.parent as RectTransform;
        rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, parent.rect.width);
        rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, parent.rect.width);
        rect.anchorMin = Vector2.zero;
        rect.anchorMax = Vector2.one;
        rect.offsetMin = Vector2.zero;
        rect.offsetMax = Vector2.zero;
        return rect;
    }
}
